<template>
	<view class="ticket_container">
		<view class="search_box">
			<view class="top">
				<u--input v-model="inputValue" @input="getList()" customStyle="background-color:#f2f2f2"
					shape="circle" placeholder="搜索发票(根据订单号搜索)" suffixIcon="search" suffixIconStyle="color: #909399">
				</u--input>
			</view>
		</view>
		<view class="record_list">
			<view class="record_item" v-for="item in invoiceList" :key="item.id">
				<view class="record_info">
					<view class="order">订单号：{{item.orderNumber}}</view>
					<view class="amount">￥{{item.amount}}</view>
				</view>
				<view class="record_time">{{item.createAt}}</view>
			</view>
			<!-- <view class="more">
				<u-loadmore :status="status" />
			</view> -->
		</view>
	</view>
</template>

<script>
	import { getTicketList } from "@/api/ticketRecord.js"
	export default {
		data() {
			return {
				invoiceList:[],
				inputValue: "",
				status: 'loadmore',
				list: 15,
				page: 0
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			// 获取列表信息
			async getList(){
				let orderNumber = this.inputValue
				const res = await getTicketList(orderNumber)
				this.invoiceList = res;
			},
			// onReachBottom() {
			// 	if (this.page >= 3) return;
			// 	this.status = 'loading';
			// 	this.page = ++this.page;
			// 	setTimeout(() => {
			// 		this.list += 10;
			// 		if (this.page >= 3) this.status = 'nomore';
			// 		else this.status = 'loading';
			// 	}, 2000)
			// }
		}
	}
</script>

<style lang="scss" scoped>
	.ticket_container {
		width: 100%;
		min-height: 100vh;
		background: rgb(245, 245, 245);

		.search_box {
			width: 100%;
			height: 96rpx;
			line-height: 96rpx;
			background-color: #fff;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 99;
			padding: 0 40rpx;
			box-sizing: border-box;

			.top {
				margin: 0 auto;
			}
		}

		.record_list {
			width: 100%;
			padding: 100rpx 14rpx 170rpx 30rpx;
			box-sizing: border-box;

			.record_item {
				width: 100%;
				height: 130rpx;
				background-color: #fff;
				border-radius: 8rpx;
				margin: 0 auto;
				margin-top: 36rpx;
				padding: 0 24rpx;
				box-sizing: border-box;
				display: flex;
				flex-direction: column;

				// justify-content: space-between;
				.record_info {
					height: 50%;
					display: flex;
					justify-content: space-between;
					align-items: center;
					color: rgb(0, 0, 0);
					font-family: 思源黑体;
					font-size: 28rpx;
					font-weight: 400;
					border-bottom: 1px dashed rgb(204, 204, 204);

					.order {}

					.amount {
						color: rgb(62, 86, 186);
					}
				}

				.record_time {
					height: 50%;
					display: flex;
					justify-content: flex-end;
					align-items: center;
					color: rgb(183, 183, 183);
					font-family: 思源黑体;
					font-size: 22rpx;
					font-weight: 400;
				}
			}

			.more {
				margin-top: 30rpx;
			}
		}
	}
</style>